<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/content/mytags.jsp"%>
<script type="text/javascript">
	$(function() {
		$('#menuPermissionTree').tree({
			onClick : function(node) {
				$('#parentPermiId').val(node.id);
				$('#detailsPermissionTree').tree({
					checkbox : true,
					url : 'permission.do?comboTree&permiType=2&parentPermiId=' + node.id + '&roleId=${roleId}'
				});
			}
		});
	});
	
	function saveMenuPermission(data) {
		var url = 'permission.do?batchSaveRolePermission&permiType=1&roleId=${roleId}&permissionIdStrs=' + data;
		doGridSubmit(url, '', null)
	}
	
	function saveDetailsPermission(data) {
		var url = 'permission.do?batchSaveRolePermission&permiType=2&roleId=${roleId}&parentPermiId=' + $('#parentPermiId').val() + '&permissionIdStrs=' + data;
		doGridSubmit(url, '', null)
	}

</script>

<div id="set-permission-layout" class="easyui-layout" fit="true">
	<div data-options="region:'center',split:true" style="width: 50%;">
		<ui:tree name="menuPermissionTree" title="菜单/导航权限设置" submit="saveMenuPermission" url="permission.do?comboTree&permiType=1&roleId=${roleId}"></ui:tree>
	</div>
	<div data-options="region:'east',split:true" style="width: 50%;">
		<ui:tree name="detailsPermissionTree" title="请求/按钮权限设置" submit="saveDetailsPermission" autoLoad="false"></ui:tree>
	</div>
</div>
<input id="parentPermiId" name="parentPermiId" type="hidden" value="">
